home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / misc / samples2 / wallpapr.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-24  |  1.8 KB  |  47 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5820
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1770
  7.    ClientWidth     =   7365
  8.    Height          =   6510
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5820
  12.    ScaleWidth      =   7365
  13.    Top             =   1140
  14.    Width           =   7485
  15.    Begin CommandButton Command1 
  16.       Caption         =   "Change Wallpaper"
  17.       Height          =   495
  18.       Left            =   3075
  19.       TabIndex        =   0
  20.       Top             =   2670
  21.       Width           =   2100
  22.    End
  23.    Begin Menu mnuExit 
  24.       Caption         =   "Exit"
  25.    End
  26. Declare Function SystemParametersInfo Lib "User" (ByVal uAction As Integer, ByVal uparam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
  27. Declare Function WriteProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String) As Integer
  28. Declare Function GetProfileInt Lib "Kernel" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer) As Integer
  29. Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
  30. Const SPIF_UPDATEINIFILE = &H1
  31. Const SPI_SETDESKWALLPAPER = 20
  32. Const SPIF_SENDWININICHANGE = &H2
  33. Sub Command1_Click ()
  34.     'Assign the filename of the wallpaper you want to use
  35.     filename$ = "c:\windows\castle.bmp"
  36.     'Change the wallpaper
  37.     X% = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, filename$, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
  38.     'Wait for Windows to process change and update win.ini
  39.     DoEvents
  40. End Sub
  41. Sub Form_Unload (Cancel As Integer)
  42.     End
  43. End Sub
  44. Sub mnuExit_Click ()
  45.     Unload Me
  46. End Sub
  47.